home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-ARM / FLOPPY.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  3KB  |  125 lines

  1. /*
  2.  * linux/include/asm-arm/floppy.h
  3.  *
  4.  * (C) 1996 Russell King
  5.  */
  6. #ifndef __ASM_ARM_FLOPPY_H
  7. #define __ASM_ARM_FLOPPY_H
  8. #if 0
  9. #include <asm/arch/floppy.h>
  10. #endif
  11.  
  12. #define fd_outb(val,port)            \
  13.     do {                    \
  14.         if ((port) == FD_DOR)        \
  15.             fd_setdor((val));    \
  16.         else                \
  17.             outb((val),(port));    \
  18.     } while(0)
  19.  
  20. #define fd_inb(port)        inb((port))
  21. #define fd_request_irq()    request_irq(IRQ_FLOPPYDISK,floppy_interrupt,\
  22.                     SA_INTERRUPT|SA_SAMPLE_RANDOM,"floppy",NULL)
  23. #define fd_free_irq()        free_irq(IRQ_FLOPPYDISK,NULL)
  24. #define fd_disable_irq()    disable_irq(IRQ_FLOPPYDISK)
  25. #define fd_enable_irq()        enable_irq(IRQ_FLOPPYDISK)
  26.  
  27. #define fd_request_dma()    request_dma(FLOPPY_DMA,"floppy")
  28. #define fd_free_dma()        free_dma(FLOPPY_DMA)
  29. #define fd_disable_dma()    disable_dma(FLOPPY_DMA)
  30. #define fd_enable_dma()        enable_dma(FLOPPY_DMA)
  31. #define fd_clear_dma_ff()    clear_dma_ff(FLOPPY_DMA)
  32. #define fd_set_dma_mode(mode)    set_dma_mode(FLOPPY_DMA, (mode))
  33. #define fd_set_dma_addr(addr)    set_dma_addr(FLOPPY_DMA, virt_to_bus((addr)))
  34. #define fd_set_dma_count(len)    set_dma_count(FLOPPY_DMA, (len))
  35. #define fd_cacheflush(addr,sz)
  36.  
  37. /* need to clean up dma.h */
  38. #define DMA_FLOPPYDISK        DMA_FLOPPY
  39.  
  40. /* Floppy_selects is the list of DOR's to select drive fd
  41.  *
  42.  * On initialisation, the floppy list is scanned, and the drives allocated
  43.  * in the order that they are found.  This is done by seeking the drive
  44.  * to a non-zero track, and then restoring it to track 0.  If an error occurs,
  45.  * then there is no floppy drive present.       [to be put back in again]
  46.  */
  47. static unsigned char floppy_selects[2][4] =
  48. {
  49.     { 0x10, 0x21, 0x23, 0x33 },
  50.     { 0x10, 0x21, 0x23, 0x33 }
  51. };
  52.  
  53. #define fd_setdor(dor)                                \
  54. do {                                        \
  55.     int new_dor = (dor);                            \
  56.     if (new_dor & 0xf0)                            \
  57.         new_dor = (new_dor & 0x0c) | floppy_selects[fdc][new_dor & 3];    \
  58.     else                                    \
  59.         new_dor &= 0x0c;                        \
  60.     outb(new_dor, FD_DOR);                            \
  61. } while (0)
  62.  
  63. /*
  64.  * Someday, we'll automatically detect which drives are present...
  65.  */
  66. extern __inline__ void fd_scandrives (void)
  67. {
  68. #if 0
  69.     int floppy, drive_count;
  70.  
  71.     fd_disable_irq();
  72.     raw_cmd = &default_raw_cmd;
  73.     raw_cmd->flags = FD_RAW_SPIN | FD_RAW_NEED_SEEK;
  74.     raw_cmd->track = 0;
  75.     raw_cmd->rate = ?;
  76.     drive_count = 0;
  77.     for (floppy = 0; floppy < 4; floppy ++) {
  78.         current_drive = drive_count;
  79.         /*
  80.          * Turn on floppy motor
  81.          */
  82.         if (start_motor(redo_fd_request))
  83.             continue;
  84.         /*
  85.          * Set up FDC
  86.          */
  87.         fdc_specify();
  88.         /*
  89.          * Tell FDC to recalibrate
  90.          */
  91.         output_byte(FD_RECALIBRATE);
  92.         LAST_OUT(UNIT(floppy));
  93.         /* wait for command to complete */
  94.         if (!successful) {
  95.             int i;
  96.             for (i = drive_count; i < 3; i--)
  97.                 floppy_selects[fdc][i] = floppy_selects[fdc][i + 1];
  98.             floppy_selects[fdc][3] = 0;
  99.             floppy -= 1;
  100.         } else
  101.             drive_count++;
  102.     }
  103. #else
  104.     floppy_selects[0][0] = 0x10;
  105.     floppy_selects[0][1] = 0x21;
  106.     floppy_selects[0][2] = 0x23;
  107.     floppy_selects[0][3] = 0x33;
  108. #endif
  109. }
  110.  
  111. #define FDC1 (0x3f0)
  112. static int FDC2 = -1;
  113.  
  114. #define FLOPPY0_TYPE 4
  115. #define FLOPPY1_TYPE 4
  116.  
  117. #define N_FDC 1
  118. #define N_DRIVE 8
  119.  
  120. #define FLOPPY_MOTOR_MASK 0xf0
  121.  
  122. #define CROSS_64KB(a,s) (0)
  123.     
  124. #endif
  125.